package com.woniuxy.carrental.service.impl;

import com.woniuxy.carrental.entity.Complaint;
import com.woniuxy.carrental.mapper.ComplaintMapper;
import com.woniuxy.carrental.service.ComplaintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 客户投诉，解决处理的实现类
 */
@Service
public class ComplaintSerivceImpl implements ComplaintService {

    @Autowired
    ComplaintMapper complaintMapper;

    /*
    客户投诉，应该在前端页面投诉，获取客户存在session中的账号
     */
    @Override
    public void addComplaint(Complaint complaint) {

        complaintMapper.addComplaint(complaint);
    }

    /*
    获取未处理或处理的投诉信息
     */
    @Override
    public List<Complaint> selectAllComplaint(boolean complaintDispose) {

        List<Complaint> complaints = complaintMapper.selectAllComplaint(complaintDispose);
        return complaints;
    }

    /*
    将未处理的投诉信息，处理掉
     */
    @Override
    public void updateComplaint(Integer complaintId) {

        complaintMapper.updateComplaint(complaintId);
    }


    /*
    处理投诉信息后，查看客户信息，并反馈
     */
    @Override
    public List<Complaint> selectComplaintByUid(Integer uid) {

        List<Complaint> complaints = complaintMapper.selectComplaintByUid(uid);
        return complaints;
    }

    /*
    分页
     */
    @Override
    public List<Complaint> selectComplaintByPage(int pageIndex, int pageSize, Complaint complaint) {
        List<Complaint> complaints = complaintMapper.selectComplaintByPage(pageIndex, pageSize, complaint);
        return complaints;
    }

    /*
    总条数
     */
    @Override
    public int selectComplaintCount() {
        int i = complaintMapper.selectComplaintCount();
        return i;
    }
}
